package com.yexiao.cofe.business.pojo;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.yexiao.core.util.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;


/**
 * 门店类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("store")
public class Store {

    /**
     * 自增主键
     */
    @TableId(type = IdType.AUTO)
    public int id;

    /**
     * 门店ID
     */
    @TableField("store_id")
    public String storeId;

    /**
     * 门店名称
     */
    @TableField("name")
    public String name;

    /**
     * 门店地址
     */
    @TableField("address")
    public String address;

    /**
     * 联系电话
     */
    @TableField("phone")
    public String phone;

    /**
     * 营业时间（格式：08:00-22:00）
     */
    @TableField("opening_hours")
    public String openingHours;

    /**
     * 营业状态（0-营业中 1-已打烊 2-暂停营业）
     */
    @TableField("status")
    public int status;

    /**
     * 地理位置
     * 格式：经度-纬度
     */
    @TableField("geo_point")
    public String geoPoint;

    /**
     * 封面图片URL
     */
    @TableField("cover_image")
    public String coverImage;

    /**
     * 排序权重（越大越靠前）
     */
    @TableField("sort")
    public int sort;

    /**
     * 创建时间
     */
    @TableField("create_time")
    public String createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    public String updateTime;

    public static final String ID = "id";
    public static final String STORE_ID = "store_id";
    public static final String NAME = "name";
    public static final String ADDRESS = "address";
    public static final String PHONE = "phone";
    public static final String OPENING_HOURS = "opening_hours";
    public static final String STATUS = "status";
    public static final String GEO_POINT = "geo_point";
    public static final String COVER_IMAGE = "cover_image";
    public static final String SORT = "sort";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";

    public static JSONObject getBaseMsg(Store store) {
        return JSONUtil.of(
                "storeId", store.getStoreId(),
                "storeName", store.getName(),
                "address", store.getAddress(),
                "phone", store.getPhone(),
                "openingHours", store.getOpeningHours(),
                "status", store.getStatus(),
                "coverImage", store.getCoverImage()
        );
    }
}